package com.koron.css2.serviceManage.mapper;

import com.koron.css2.serviceManage.bean.BusinessBranchBean;
import com.koron.css2.serviceManage.queryBean.BusinessBranchQueryBean;
import com.koron.css2.serviceManage.vo.BusinessBranchVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.koron.ebs.mybatis.EnvSource;

import java.util.List;
@EnvSource("_default")
public interface BusinessBranchMapper {

    /**
     * 校验字段内容重复
     */
    @Select("select count(*) from PUB_BUSINESS_BRANCH where ${key} = #{val}")
    Integer check(@Param("key") String key, @Param("val") String val);

    /**
     * 校验字段内容重复-排除当前记录
     */
    @Select("select count(*) from PUB_BUSINESS_BRANCH where ${key} = #{val} and id <> #{id}")
    Integer check2(@Param("key") String key, @Param("val") String val, @Param("id") String id);

    /**
     * 新增网点
     *
     * @param bean
     * @return
     */
    Integer insertBusinessBranch(BusinessBranchBean bean);

    /**
     * 列表查询
     *
     * @return
     */
    List<BusinessBranchVO> selectBusinessBranchList(BusinessBranchQueryBean bean);

    /**
     * 根据id查询网点
     *
     * @param id
     * @return
     */
    @Select("select * from PUB_BUSINESS_BRANCH where  id= #{id}")
    BusinessBranchBean selectBusinessBranchById(@Param("id") String id);

    Integer updateBusinessBranch(BusinessBranchBean bean);

}
